package ma.fizazi.missionsmanagement.presentation.components;

import java.beans.PropertyEditorSupport;

import ma.fizazi.missionsmanagement.business.demandes.DemandeBusiness;
import ma.fizazi.missionsmanagement.model.NatureMission;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class NatureDemandeEditor extends PropertyEditorSupport {

	@Autowired
	DemandeBusiness produitBusiness;

	// Converts a String to a Groupe (when submitting form)

	@Override
    public void setAsText(String text) {
        //Country c = this.countryService.findById(Long.valueOf(text));
        NatureMission fdp = this.produitBusiness.getNatureDemandeById(Integer.valueOf(text));
        this.setValue(fdp);
    }
}
